package com.ltsh.fim.common.enums;

/**
 * Created by Random on 2018/2/9.
 */

public enum RequestType {
    REGISTER_REQ((byte)1, "注册请求"),
    LOGIN_REQ((byte)2, "登录请求"),
    LOGIN_OUT_REQ((byte)3, "登录注销"),
    P2P_REQ((byte)4, "点对点消息请求"),
    HEART_BEAT_REQ((byte)99, "心跳");


    private byte value;
    private String message;
    RequestType(byte value, String message) {

        this.value = value;
        this.message = message;
    }


    public byte getValue() {
        return value;
    }

    public void setValue(byte value) {
        this.value = value;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public static RequestType getByValue(byte value) {
        RequestType[] values = values();
        for (int i = 0; i < values.length; i++) {
            if(value == values[i].getValue()) {
                return values[i];
            }
        }
        return null;
    }
}
